#include <bits/stdc++.h>
using namespace std;
const int MAXN = 505, mod = 998244353;
char str[MAXN]; int c[MAXN], cp[MAXN];
int sp[MAXN], C[MAXN][MAXN], fact[MAXN];
int dp[MAXN][MAXN], tmp[MAXN][MAXN], ttmp[MAXN];
int main() {
	freopen("employ.in", "r", stdin);
	freopen("employ.out", "w", stdout);
	int n, m; scanf("%d %d", &n, &m); scanf("%s", str + 1);
	for (int i = 0; i <= n; i++) {
		C[i][0] = 1; for (int j = 1; j <= i; j++) C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;
	}
	fact[0] = 1; for (int i = 1; i <= n; i++) fact[i] = 1ll * fact[i - 1] * i % mod;
	for (int i = 1; i <= n; i++) {int a; scanf("%d", &a); c[a]++;}
	for (int i = 0; i <= n; i++) cp[i] = (i ? cp[i - 1] : 0) + c[i];
	for (int i = 1; i <= n; i++) sp[i] = sp[i - 1] + (str[i] == '1');
	if (m > sp[n]) return puts("0"), 0;
	dp[0][c[0]] = 1;
	for (int i = 1; i <= n; i++) {
		if (str[i] == '0') {
			for (int j = 0; j <= sp[i - 1]; j++) {
				int x = i - 1 - sp[i - 1] + j;
				for (int _ = 0; _ < c[x + 1]; _++) {
					for (int k = 0; k <= n; k++) ttmp[k] = 0;
					for (int k = 0; k <= n; k++) {
						int bot = sp[i] + k - (cp[x] + _);
						if (bot) ttmp[k] = (ttmp[k] + 1ll * dp[j][k] * bot) % mod;
						ttmp[k + 1] = (ttmp[k + 1] + dp[j][k]) % mod;
					}
					for (int k = 0; k <= n; k++) dp[j][k] = ttmp[k];
				}
			}
		}
		else {
			for (int j = 0; j <= sp[i - 1]; j++) {
				for (int k = 1; k <= n; k++) tmp[j + 1][k - 1] = 1ll * dp[j][k] * k % mod;
				tmp[j + 1][n] = 0;
			}
			for (int j = 1; j <= sp[i]; j++) {
				int x = i - sp[i] + j - 1;
				for (int _ = 0; _ < c[x + 1]; _++) {
					for (int k = 0; k <= n; k++) ttmp[k] = 0;
					for (int k = 0; k <= n; k++) {
						int bot = sp[i] + k - (cp[x] + _);
						if (bot) ttmp[k] = (ttmp[k] + 1ll * tmp[j][k] * bot) % mod;
						ttmp[k + 1] = (ttmp[k + 1] + tmp[j][k]) % mod;
					}
					for (int k = 0; k <= n; k++) tmp[j][k] = ttmp[k];
				}
				for (int k = 0; k <= n; k++) dp[j][k] = (dp[j][k] + tmp[j][k]) % mod;
			}
		}
	}
	int ans = 0;
	for (int j = 0; j <= sp[n] - m; j++) {
		int x = n - sp[n] + j;
		for (int k = 0; k <= n; k++) {
			int bot = sp[n] + k - cp[x];
			if (bot <= cp[n] - cp[x] && bot >= 0 && k + (cp[n] - cp[x]) - bot >= 0) {
				ans = (ans + 1ll * dp[j][k] * C[cp[n] - cp[x]][bot] % mod * fact[bot] % mod * fact[k + (cp[n] - cp[x]) - bot]) % mod;
			}
		}
	}
	printf("%d\n", ans);
}
/*
run employ < employ1.in > employ1.out
run employ < employ2.in > employ2.out
run employ < employ3.in > employ3.out
run employ < employ4.in > employ4.out
run employ < employ5.in > employ5.out
diff employ1.out employ1.ans -Z
diff employ2.out employ2.ans -Z
diff employ3.out employ3.ans -Z
diff employ4.out employ4.ans -Z
diff employ5.out employ5.ans -Z
*/
/*
read in UTF-8 mode

uid=109114

我草懒得写这个 byd 擂台游戏了，纯粹依托

写一下这四个题的题解方便 co（

t4:

考虑到尝试去 dp 每个位置的人是否主动离场，那么可以发现我们每一个位置都会出现形如这个位置的 c <= x 与 c > x 这类限制

特别的，在 str[i] == 0 的时候，c <= inf，在 str[i] == 1 的时候，根据这个人是否遗憾离场决定两类限制

我们可以发现 c <= x 与 c > x 其中的 x 是单调不降的，这样是方便我们按照 c 的值域进行扫描线并计数的，
然后我们就可以将 c 与限制之间做匹配问题，这个是经典 trick，
可以在 dp 状态里面记录有多少 c 要匹配 c <= x 以及有多少 c > x 的限制将要匹配后面的 c
同时需要维护钦定了多少人遗憾离场，因此状态是 O(n^4)

不难发现状态之间有个等式，实际上状态只有 O(n^3)，所以做完了

t3:

大家应该都会做，复杂度瓶颈在 dfs 可以手写递归栈（

空间致敬我常常追忆过去

t2:

观察到 cpu 巨快无比，直接写暴力就过了

t1:

观察到模拟费用流（






我草我要饿死了
为什么 csp-s 没有吃的啊 /fn/fn/fn/fn/fn/fn/fn/fn/fn

















我草怎么还没结束啊



























一键触发 6543333333311111111777777775h5h5h5h5h5h5h5h6h
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                */
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                



















































































































































































































































































































































































































































































































































































































































































































